export default {
	data () {
		return {
			planShow: 1,
			pageIndex:1,
			pageSize:1,
			list:null,
			page:1,
			deleteList:'',
			nullData: false,
		}
	},
	mounted(){
		this.getlist(1,{pageIndex:this.pageIndex,pageSize:this.pageSize})
	},
	onReachBottom() {
		if(this.nullData == true){
			return;
		}
		this.page = this.page + 1
		if(this.planShow == 1) {
			this.getlist(2,{pageIndex:this.page,pageSize:this.pageSize})			
		}else {
			this.getlist(1,{pageIndex:this.page,pageSize:this.pageSize,type:'all'})		
		}
		
	},
	methods:{
		getlist(e,v){
			e == 2?
				this.$api.InterventionPlanList(v).then((res)=>{
					var data = res.data.result.elements || []
					this.list = this.list ? this.list.concat(data) : data
					if(this.list.length >= res.data.result.totalCount){
						this.nullData = true;
					}
				})
			:
				this.$api.InterventionPlanPlanList(v).then((res)=>{
					this.list = this.list ? this.list.concat(res.data.result.elements || []) : res.data.result.elements
					if(this.list.length >= res.data.result.totalCount){
						this.nullData = true;
					}
				})
		},
		detail(item){
			uni.navigateTo({
				url:'/pages/monitor/interventionPlan/toView?id='+item.id
			})
		}
	}
}